package com.yuexun.dhdoctor.module.contractmanage.ui;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.base.BaseKJActivity;
import com.yuexun.dhdoctor.module.contractmanage.bean.ConTractManageBean;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by work-jx on 2016/10/26.
 */
public class Act_ContractManageDetail extends BaseKJActivity {
    @Bind(R.id.title_tv)
    TextView titleTv;
    @Bind(R.id.healthdetail_icon)
    ImageView healthdetailIcon;
    @Bind(R.id.healthdetail_name)
    TextView healthdetailName;
    @Bind(R.id.healthdetail_age)
    TextView healthdetailAge;
    @Bind(R.id.healthdetail_sex)
    TextView healthdetailSex;
    @Bind(R.id.healthdetail_tv_telephone)
    TextView healthdetailTvTelephone;
    @Bind(R.id.healthdetail_tv_card)
    TextView healthdetailTvCard;
    @Bind(R.id.healthdetail_tv_address)
    TextView healthdetailTvAddress;

    ConTractManageBean.RowsBean conTractManageBean;


    @Override
    public void setRootView() {
        setContentView(R.layout.act_healthdetail);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        setTitle();
        conTractManageBean = (ConTractManageBean.RowsBean) getIntent().getExtras().get("contractManageDetail");
        setInfo();
    }


    private void setInfo() {
        healthdetailName.setText(conTractManageBean.getName());
        healthdetailAge.setText("年龄：");
        if ("1".equals(conTractManageBean.getSex())) {
            healthdetailSex.setText("性别：男");
            healthdetailIcon.setImageResource(R.drawable.pic_man);
        } else if ("2".equals(conTractManageBean.getSex())) {
            healthdetailSex.setText("性别：女");
            healthdetailIcon.setImageResource(R.drawable.pic_woman);
        } else {
            healthdetailSex.setText("性别：不详");
            healthdetailIcon.setImageResource(R.drawable.pic_man);
        }
        healthdetailTvTelephone.setText(conTractManageBean.getLinkphone());
        healthdetailTvCard.setText(conTractManageBean.getIdcard());
        healthdetailTvAddress.setText(conTractManageBean.getAddress());

    }


    protected void setTitle() {
        titleTv.setText("签约病人详情");
    }

    @Override
    @OnClick({R.id.healthdetail_record, R.id.healthdetail_inspect,
            R.id.healthdetail_test, R.id.back})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.healthdetail_record:
                intent = new Intent(this, Act_ContractManageRecord.class);
                intent.putExtra("healthid", conTractManageBean.getCardnum());
                startActivity(intent);
                break;
            case R.id.healthdetail_inspect:
                intent = new Intent(this, Act_ContractManageInspect.class);
                intent.putExtra("healthid", conTractManageBean.getCardnum());
                startActivity(intent);
                break;
            case R.id.healthdetail_test:
                intent = new Intent(this, Act_ContractManageTest.class);
                intent.putExtra("healthid", conTractManageBean.getCardnum());
                startActivity(intent);
                break;
            case R.id.back:
                finish();
                break;
        }
    }

}
